A complete system for encoding and decoding videos include an encoder part and a decoder part. Generally, on an encoder side under a hybrid encoding framework, video signals pass through a predicting module first. The encoder selects the best mode in several prediction modes according to certain optimization criteria, and then generates residual signals. The residual signals are transformed and quantized, and then sent to an entropy encoding module, and finally form output streams. On the decoder side, the output streams are resolved to obtain prediction mode information, and a predicted signal that is completely the same as the signal on the encoder is generated. Afterward, a quantized transformation coefficient value is obtained from the resolved streams, and inverse quantization and inverse transformation are performed to generate a reconstructed residual signal. Finally, the predicted signal and the reconstructed residual signal are combined to form a reconstructed video signal.
Under a hybrid encoding framework, a key technology in the encoding process is transformation. The function of transformation is: transforming a residual into another expression through linear operation on a residual block, and under such an expression, energy of data is centralized on a few transformation coefficients, and the energy of most other coefficients is very low or even zero. Through such transformation, the subsequent entropy encoding can be performed efficiently. In video encoding, for a residual block X, if X is regarded as a matrix, the transformation is actually to multiply matrixes. A form of the multiplication is F=C·X·R, in which C and R are transformation matrixes whose dimensions are the same as the dimensions of X, and F is a transformation coefficient matrix as a result of the transformation. Compared with other types of transformation in the prior art, discrete cosine transform (Discrete Cosine Transform, DCT) is a better tradeoff between complexity and performance, and therefore is widely applied.
In the video encoding technology, a mode dependent directional transform (Mode dependent Directional Transform, MDDT) technology is adopted. The essence of the MDDT is: (1) The residuals obtained through different intra-frame prediction modes reflect different statistic features, and therefore, different transformation matrixes should be used, according to different prediction directions, to improve compression encoding efficiency; and (2) to reduce complexity of transformation, the MDDT separates rows from columns, and generates a pair of transformation matrixes, namely, a column transformation matrix Ci and a row transformation matrix Ri, and therefore, the transformation process is Fi=Ci·X·Ri, in which i is a corresponding intra-frame prediction mode, X is a prediction residual, and Fi is a transformed prediction residual; Ci and Ri show that horizontal transformation is separated from vertical transformation by a Ci matrix and an Ri matrix, which is known as transformation with columns separated from rows.
In the process of implementing the foregoing transformation, the inventor finds at least the following problems in the prior art:
Although the MDDT technology can apply a different set of transformation matrixes to different prediction directions for intra-frame encoding, in a practical encoding process the statistic features of residual data still differ obviously even if the intra-frame prediction mode is the same. Therefore, the foregoing method, in which one intra-frame prediction mode corresponds to a set of transformation matrixes, is still not accurate enough, and leads to low efficiency of subsequent encoding.